<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="models.StoreItemModel"%>
<%@page import="java.util.List"%>
<%@page import="models.StoreModel"%>
<%
	List<StoreItemModel> listStoreItem = (List<StoreItemModel>) request.getAttribute("listStoreItem");
%>

<jsp:include page="/admin/layouts/header.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>
<script type="text/javascript" src="/admin/js/list_store_item.js"></script>
<script type="text/javascript" src="/admin/js/ajax_store_item.js"></script>
<script type="text/javascript">
	var url = "http://<%=request.getServerName()+":"+request.getServerPort()%>/ajax/deal";
</script>
        <div class="maincontent noright">
        	<div class="maincontentinner">
            	
                <ul class="maintabmenu">
                	<li class="current"><a href="/admin/store-item/list/">Danh sách sản phẩm</a></li>
                	<li><a href="/admin/store-item/add/">Thêm sản phẩm</a></li>
                </ul><!--maintabmenu-->
                
                <div class="content">
                	<jsp:include page="/admin/elements/message.jsp"/>
                	<div class="contenttitle radiusbottom0">
	                	<h2 class="table"><span>Danh sách sản phẩm</span></h2>
	                </div>              
	                <form method="post" action="/admin/store-item/list/" class="stdform" id="search_product">
	                	<div class="one_half">	
            				<p>
	                        	<label>Tên sản phẩm</label>
	                            <input type="text" class="smallinput" name="productName" id="productName">
	                        </p>
            				<p>
	                        	<label>Mã sản phẩm</label>
	                            <input type="text" class="smallinput" name="productId" id="productId">
	                        </p>                      	
	                        <p class="stdformbutton">
	           					<input type="hidden" class="smallinput" name="action" id="action" value="search_product">            					
	                        	<button class="submit radius2">Submit</button>
	                            <input type="reset" value="Reset Button" class="reset radius2">
	                        </p>
                    	</div>    
                    	<div class="one_half last"> 
                    	 	<p>
			                	<label>Loại sản phẩm</label>	               	
			                    <select class="radius3 action-value" name="type">
			                    	<option>---Vui lòng chọn---</option>		                    
			                    	<option value="0">VC</option>
			                    	<option value="1">SP</option>			                                  	
			                    </select>
			                </p>                    		
                    	</div>                  
            		</form>
            		<br clear="all" /><br />            		
	                <table cellspacing="0" cellpadding="0" border="0" class="stdtable stdtablecb" id="list-table">
	                    <colgroup>
	                        <col class="con0">
	                        <col class="con1">
	                        <col class="con0">
	                        <col class="con1">
	                        <col class="con0">
	                        <col class="con1">
	                        <col class="con0">
	                        <col class="con1">
	                        <col class="con0">
	                        <col class="con1">
	                        
	                    </colgroup>
	                    <thead>
	                        <tr>
	                        	<th class="head0">STT</th>
	                            <th class="head1">Deal</th>
	                            <th class="head0">Sản phẩm</th>
	                            <th class="head1">SL DK</th>
	                            <th class="head0">SL Tổng nhập</th>
	                            <th class="head1">SL Tồn</th>
	                            <th class="head0">SL Đã giao</th>
	                            <th class="head1">SL Đang giao</th>
	                            <th class="head0">SL Nhập LOC</th>
	                            <th class="head1">Action</th>	                            
	                        </tr>
	                    </thead>
	                    <tfoot>
	                        <tr>
	                        	<th class="head0">STT</th>
	                            <th class="head1">Deal</th>
	                            <th class="head0">Sản phẩm</th>
	                            <th class="head1">SL DK</th>
	                            <th class="head0">SL Tổng nhập</th>
	                            <th class="head1">SL Tồn</th>
	                            <th class="head0">SL Đã giao</th>
	                            <th class="head1">SL Đang giao</th>
	                            <th class="head0">SL Nhập LOC</th>
	                            <th class="head1">Action</th>	                            
	                        </tr>
	                    </tfoot>
	                    <tbody>
	                    	<% for (int i = 0; i < listStoreItem.size(); i++) { %>
	                        <tr>
	                        	<td class="center"><%=i+1 %></td>
	                        	<td class="left">[<%=listStoreItem.get(i).getDealId() %>]<%=listStoreItem.get(i).getDealName() %></td>
	                        	<td class="left">[<%=listStoreItem.get(i).getProductId() %>]
	                        		<%
	                        			if(listStoreItem.get(i).getType()==0) { out.print("-VC-");} 
	                        			else { out.print("-SP-"); }
	                        		%>  
	                        	<%=listStoreItem.get(i).getProductName() %></td>
	                            <td class="center"><%=listStoreItem.get(i).getOrder() %></td>
	                        	<td class="center"><%=listStoreItem.get(i).getAmount() %></td>
	                        	<td class="center"><%=listStoreItem.get(i).getInventory() %></td>
	                        	<td class="center"><%=listStoreItem.get(i).getDelivered() %></td>
	                        	<td class="center"><%=listStoreItem.get(i).getDelivery() %></td>
	                        	<td class="center"><%=listStoreItem.get(i).getLoc() %></td>	                        	
	                            <td class="center">
									<a title="Lịch sử XN" href="/admin/transaction/list/<%=listStoreItem.get(i).getId() %>" class="list">
										Lịch sử XN
									</a>
									 |
									<a title="Nhập hàng" href="/admin/store-item/add/<%=listStoreItem.get(i).getId() %>" class="add">
										Nhập hàng
									</a>
									 | 
									<a title="Xuất hàng" href="/admin/store-item/edit/<%=listStoreItem.get(i).getId() %>" class="edit">
										Xuất hàng
									</a>
								</td>
	                        </tr>
	                        <% } %>
	                    </tbody>
	                </table>
                </div><!--content-->
                
            </div><!--maincontentinner-->
            
            <jsp:include page="/admin/elements/copyright.jsp">
            	<jsp:param name="language" value="1" />
			</jsp:include>
            
        </div><!--maincontent-->
        
<jsp:include page="/admin/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>